#!/bin/bash
#
# $Id: make-tests.sh 15 2010-09-30 13:48:46Z olexiy.palinkash@gmail.com $

cd src/tests/

# compiling C++ test programs
for i in *.cpp; do
	g++ $i -o ../../bin/$i.exe > /dev/null 2>&1
	if [ "$?" != 0 ]; then
		echo "Failed to compile $i"
	else
		echo "Compiled: $i"
	fi
done

# compiling Pascal test programs
for i in *.pas; do
	fpc $i -o../../bin/$i.exe > /dev/null 2>&1
	if [ "$?" != 0 ]; then
		echo "Failed to compile $i"
	else
		echo "Compiled: $i"
	fi
done

# compiling Java test programs
for i in *.java; do
	javac -d ../../bin/ $i > /dev/null 2>&1
	if [ "$?" != 0 ]; then
		echo "Failed to compile $i"
	else
		echo "Compiled: $i"
	fi
done

# compiling PHP test programs
for i in *.php; do
	php -n -l $i > /dev/null 2>&1
	if [ "$?" != 0 ]; then
		echo "Failed to compile $i"
	else
		echo "Compiled: $i"
		cp $i ../../bin/$i
	fi
done

# compiling Perl test programs
for i in *.pl; do
	perl -c $i > /dev/null 2>&1
	if [ "$?" != 0 ]; then
		echo "Failed to compile $i"
	else
		echo "Compiled: $i"
		cp $i ../../bin/$i
	fi
done

# compiling Python test programs
for i in *.py; do
	echo "Compiled: $i"
	cp $i ../../bin/$i
done

cd ../../

